-
Notifications
You must be signed in to change notification settings - Fork 232
Conversation
Replace `Backbone.utilsBackbone.utils` with `Backbone.utils`
I was blind in one eye for many hours. However, the travis build of the pull request has passed. |
@@ -194,7 +194,7 @@ module.exports = class View extends Backbone.View | |||
# e.g. | |||
# @delegate('click', 'button.confirm', @confirm) | |||
delegate: (eventName, second, third) -> | |||
if Backbone.utils | |||
if Backbone.utils and Backbone.utils?.delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is doing the same thing as it already was.
I would move this change to the next line:
if Backbone.utils
return Backbone.utils.delegate?(this, eventName, second, third)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conclusion
Without determining whether Backbone.utils
exists and Backbone.utils.delegate
/Backbone.utils.undelegate
are functions, any call of Chaplin.delegate
or Chaplin.undelegate
results in an error for me:
TypeError: Backbone.utils.undelegate is not a function
or
TypeError: Backbone.utils.undelegate is not a function
The Backbone.utils
object exists - but without delegate
and undelegate
functions.
Please check the source: https://github.com/paulmillr/exoskeleton/blob/master/lib/utils.js
The latest release of exoskeleton does not include these functions (possibly deprecated?).
As already mentioned above, I want to use Chaplin
with the latest release of exoskeleton. This could be a possible fix for paulmillr/exoskeleton#87, isn't it?
The solution
And as far I understand, Chaplin
seems to have its own, native delegate
and undelegate
functions:
View.delegate
: chaplin/src/chaplin/views/view.coffee#L202-L225
View.undelegate
: chaplin/src/chaplin/views/view.coffee#L260-L276
Please correct me, if I am wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest release of exoskeleton does not include these functions (possibly deprecated?).
I know, I'm the one who removed them :)
The right answer is to fix Chaplin to work with NativeView and not rely on utils.delegate / utils.undelegate. I started #780 last year but I haven't had a project that needed Chaplin in a long time and so I haven't had time to dedicate to fix all the edge cases. Feel free to contribute to that pull, or just use Exoskeleton 0.6.x which should work with Chaplin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I need several bug fixes from 0.7.0
- I can not downgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind telling me what they are? We could maybe do a 0.6.4.
You might also want to try just using regular old Backbone. Why do you need Exoskeleton?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will stick to your recommendation. I want to provide a patch for NativeViews, since my app is based on Chaplin and I like it.
Exoskeleton runs faster on low-memory Firefox OS devices, in comparison to classic Backbone.
Wrap delegate and undelegate
See #851
Tested with:
1.0.1
0.7.0
1.1.6
3.5.0
Example: https://github.com/opendradio/app